home *** CD-ROM | disk | FTP | other *** search
- Path: andrew.cmu.edu!mp52+
- From: Matthew Edward Patton <mp52+@andrew.cmu.edu>
- Newsgroups: comp.lang.c++
- Subject: help: templates + destructors
- Date: Sun, 10 Mar 1996 03:28:46 -0500
- Organization: Civil and Environmental Engineering, Carnegie Mellon, Pittsburgh, PA
- Message-ID: <klEd_y200iWTM=AEsS@andrew.cmu.edu>
- NNTP-Posting-Host: po2.andrew.cmu.edu
-
- I thought I was getting the hang of c++ but I'm stumped at the following
- error. If anyone could shed some light on this I'd appreciate it
- greatly.
-
- compiler: g++ v2.5.4 (netbsd)
-
- template<class T>
- class field {
- T value;
- public:
- field(void) { value = (T) 0; };
- field(byte) { value = (T) 0; };
- ~field(void) { return; };
- }
-
- field<char*>::field(void) {
- // override class default;
- }
- field<char*>::field(byte length) {
- //override class default;
- value = new char[length];
- }
-
- field<char *>::~field(void) {
- delete[] value;
- }
-
- The error:
- no 'field' member function declared in class 'field<char*>'
-
- I took that to mean the compiler can't define a custom destructor if a
- custom constructor doesn't already exist. Thing is, I've got two
- constructors defined. I appreciate your help.
-